﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OfficeOpenXml;

namespace T4.ReferTest
{
    class 引用dll
    {
        public static void Main(string[] args)
        {

            //string textInfo = this.Host.ResolvePath(@"SampleFiles\SampleExcel.xlsx");
            string ExcelPath = @"E:\git项目\T4\T4\T4Core\SampleFiles\Sample.xlsx";
            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
            using (ExcelPackage package = new ExcelPackage(new FileInfo(ExcelPath)))
            {
                //其中列1是要写的名称，列2是名称的值
                ExcelWorksheet worksheet = package.Workbook.Worksheets["Sheet1"];
                int Row = worksheet.Dimension.End.Row;
                int Column = worksheet.Dimension.End.Column;
                for (int i = 0; i < Row; i++)
                {
                    var field = worksheet.Cells[i+1,1].Value;
                    var value = worksheet.Cells[i+1,2].Value;
                }

            }
        }

    }
}
           
